In many large and key application programs, a computer performs a large quantity of tasks every second. When multiple tasks are combined together to complete a service requirement, the service requirement may be referred to as a transaction. The transaction has atomicity and consistency.
To ensure the atomicity and the consistency of the transaction, a write-ahead logging (WAL) method is generally used in existing transaction processing. In an embodiment, an existing computer system includes a processor, an internal memory, and an external memory, and the internal memory is a dynamic random access memory (DRAM), and a log area is set in the external memory. When receiving a transaction processing request, the processor first writes transaction data of a transaction to the internal memory from a cache of the computer system, and then, to the log area of the external memory, writes the transaction data that has been written to the internal memory. After all transaction data of the transaction is written to the log area, the processor writes the transaction data to the external memory to commit the transaction.
However, all transaction data in the foregoing existing transaction processing method needs to be written to the internal memory before being written to the log area, and the transaction can be committed only after all the transaction data is written to the log area. That is, the transaction data needs to be written twice in a transaction processing process, which leads to a low transaction processing speed.